package com.example.s04_mybatis_plus.controller;

import com.example.s04_mybatis_plus.pojo.User;
import com.example.s04_mybatis_plus.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class UserController
{
    @Autowired
    private IUserService userService;

    @RequestMapping("/list")
    public String list(Model model)
    {
        List<User> list = userService.list();
        model.addAttribute("list",list);

        return "list";
    }
}
